package org.xwb.springcloud.messagetype.simple;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
import org.xwb.springcloud.constant.MqConstant;

import javax.annotation.Resource;

/**
 * @author 10564
 */
@Component
public class SimpleProducer {

    private static final Logger log = LoggerFactory.getLogger(SimpleProducer.class);

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void senderSimple(String userModel) {
        log.info("\n简单生产者发送消息:{}\n", JSONObject.toJSONString(userModel));
        rabbitTemplate.convertAndSend(MqConstant.SIMPLE_MQ_NAME,userModel);
    }
}
